package com.itheima.test01;

import java.util.Random;
import java.util.Scanner;

public class testA {

    public static void main(String[] args) {
       /*
        //    猜数字游戏
        Scanner sc = new Scanner(System.in);
        Random r = new Random();
        int randomNum = r.nextInt(100) + 1;
        while(true) {
            System.out.println("请输入一个1-100之间的数字:");
            int num = sc.nextInt();
            if(num > randomNum){
                System.out.println("大了!");
            }else if(num < randomNum){
                System.out.println("小了!");
            }else{
                System.out.println("对了!");
                break;
            }
        }
        */


        //基本数据类型
        int num = 100;
        System.out.println("调用前" + num);
        change(num);
        System.out.println("调用后" + num);

        //引用数据类型
        int[] arr = {100,500,300,400};
        System.out.println(arr);
        System.out.println("调用前" + arr[1]);
        change(arr);
        System.out.println(arr);
        System.out.println("调用后" + arr[1]);

    }

    //基本数据类型
    public static void change (int num) {
        num = 200;
    }

    //引用数据类型
    public static void change (int[] arr) {
        System.out.println(arr);
        arr[1] = 200;
    }
}


